package org.jeecg.modules.demo.crm.controller;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.demo.crm.entity.CInvoiceSplit;
import org.jeecg.modules.demo.crm.entity.CProjectPreview;
import org.jeecg.modules.demo.crm.entity.CProjectPricePreview;
import org.jeecg.modules.demo.crm.entity.CSubProjectPreview;
import org.jeecg.modules.demo.crm.service.ICProjectPreviewService;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;

import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;

 /**
 * @Description: 项目数据看板
 * @Author: jeecg-boot
 * @Date:   2025-07-18
 * @Version: V1.0
 */
@Api(tags="项目数据看板")
@RestController
@RequestMapping("/crm/cProjectPreview")
@Slf4j
public class CProjectPreviewController extends JeecgController<CProjectPreview, ICProjectPreviewService> {
	@Autowired
	private ICProjectPreviewService cProjectPreviewService;
	
	/**
	 * 分页列表查询
	 *
	 * @param cProjectPreview
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */
	//@AutoLog(value = "项目数据看板-分页列表查询")
	@ApiOperation(value="项目数据看板-分页列表查询", notes="项目数据看板-分页列表查询")
	@GetMapping(value = "/list")
	public Result<IPage<CProjectPreview>> queryPageList(CProjectPreview cProjectPreview,
								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								   HttpServletRequest req) {

		IPage<CProjectPreview> pageList = cProjectPreviewService.queryPageList(pageNo, pageSize, cProjectPreview);

		return Result.OK(pageList);
	}

	@ApiOperation(value="子项目记录", notes="子项目记录")
	@GetMapping(value = "/subProjectList")
	public Result<IPage<CSubProjectPreview>> subProjectList(CSubProjectPreview cSubProjectPreview,
															@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
															@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
		IPage<CSubProjectPreview> subProjectPreviewsList = cProjectPreviewService.subProjectList(pageNo, pageSize,cSubProjectPreview);
		return Result.OK(subProjectPreviewsList);
	}





}
